using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using ViCode_LeVi.Controls.Logs;
using ViCode_LeVi.Controls.Charts;

namespace ViCode_LeVi.Controls.Reports
{
    public partial class QQSStatementSubReport : DevExpress.XtraReports.UI.XtraReport
    {
       

        public QQSStatementSubReport()
        {
            this.InitializeComponent();
        }

        private bool CreateDataBindings()
        {
            bool flag = true;
            try
            {
                this.cellID.DataBindings.Add("Text", base.DataSource, "ID");
                this.cellStatementQn.DataBindings.Add("Text", base.DataSource, "StatementQn");
                this.cellStatementQl.DataBindings.Add("Text", base.DataSource, "StatementQl");
                this.cellStatementSy.DataBindings.Add("Text", base.DataSource, "StatementSy");
            }
            catch (Exception exception)
            {
                flag = false;
                //rsErr = "Fehler in QQSStatementSubReport.CreateDataBindings: " + exception.Message;
                Log.LogException(exception);
            }
            return flag;
        }

        public bool CreateReport(FactorType eEFType, ref bool bFactors)
        {
            bool flag = true;
            try
            {
                this.cellEFType.Text =FactorType_Helper.GetFactorTypeString(eEFType);
                var data = new ReportDataSourceHelper().GetReportQQSStatementList(eEFType);
                base.DataSource = data;
                if (data.Length > 0)
                {
                    bFactors = true;
                    return this.CreateDataBindings();
                }
                bFactors = false;
            }
            catch (Exception exception)
            {
                flag = false;
                //rsErr = "Fehler in QQSStatementSubReport.CreateReport: " + exception.Message;
                Log.LogException(exception);
            }
            return flag;
        }                      
    }
}
